﻿@{
    ViewData["Title"] = "更新日志";
    Layout = "~/Views/Shared/_LayoutNone.cshtml";
}
<style>
    body {
        background-color: #fff;
    }

    h1 {
        padding: 10px;
    }

    h2 {
        color: #009688;
        padding: 10px;
    }

    ol {
        border-bottom: solid 1px #ccc;
        margin-bottom: 20px;
        padding: 10px 10px 10px 50px;
    }

        ol li {
            padding: 5px 10px;
            list-style-type: decimal;
        }
</style>
<div class="layui-fluid" style="background-color: #fff;">
    <div class="layui-row" style="border: none;">
        <form class="layui-form" action="" style="border: none;">
            <div class="layui-form-item" style="float: right">
                <div class="layui-input-inline" style="text-align: right;">
                    <input type="checkbox" lay-filter="filter_is_always_show" id="is_always_show" name="is_always_show" title="不再弹窗显示" lay-skin="primary">
                </div>
            </div>
        </form>
    </div>

    <div class="layui-col-md12" id="log_list" style="background-color: #fff;"></div>
</div>

<script src="~/layuiadmin/layui/layui.js"></script>
<script>
    layui.config({
        base: '/layuiadmin/'
    }).extend({
        index: '/lib/index'
    }).use(['index', 'laydate', 'form'], function () {
        var $ = layui.$
            , form = layui.form
            , admin = layui.admin
            , laydate = layui.laydate;

        // 监听指定开关
        form.on('checkbox(filter_is_always_show)', function (data) {
            console.log(`filter_is_always_show checked=${this.checked}`)
            if (this.checked) {
                localStorage.setItem("CLOUDIN_MINIX_IS_SHOW_UPDATE_LOG", true);
            } else {
                localStorage.setItem("CLOUDIN_MINIX_IS_SHOW_UPDATE_LOG", false);
            }
        });

        // 默认加载
        $(function () {
            admin.req({
                url: '/main/updatelogs'
                , data: null
                , done: function (res) {
                    localStorage.setItem("CLOUDIN_MINIX_VERSION_CODE", res.data.version_code);
                    $("#log_list").html(res.data.logs);
                }
            });
        });

    })
</script>